#include <stdlib.h>
#include <string.h>
#include "genericdao.h"
#include "Endereco.h"

static int64_t get_ref(Endereco *this);
static void set_ref(Endereco *this, int64_t novo);
static int64_t get_id(Endereco *this);
static void set_id(Endereco *this, int64_t novo);

static Endereco* create()
{
  Endereco *ptr = malloc(sizeof(Endereco));
  if(!ptr) return 0;
  memset(ptr,0,sizeof(Endereco));
  ptr->id=(GenericVar)GVAR(T_INT64);
  return ptr;
}

static int64_t get_ref(Endereco *this)
{
  return this->ref;
}

static void set_ref(Endereco *this, int64_t novo)
{
  this->ref = novo;
}

static int64_t get_id(Endereco *this)
{
  return this->id.INT64VAL;
}

static void set_id(Endereco *this, int64_t novo)
{
  setVar(&this->id,novo);
}


static FieldEntry *getFields()
{
  static Endereco v;
  static FieldEntry fe[] = {
    {"id", ((long)&v.id - (long)&v)},
    {0, 0}
  };
  return fe;
}

EnderecoInterface EnderecoI = {
create,
getFields,
get_ref,
set_ref,
get_id,
set_id
};
